package com.sumainfor.pc.market.controller.rentadviser;

import com.sumainfor.common.util.JsonResult;
import com.sumainfor.pc.market.service.RdActivityService;
import com.sumainfor.pc.market.service.RdJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
 * 活动
 */
@RestController
@RequestMapping("/rentadviser/Activity")
public class RdActivityController implements Serializable {
    @Autowired
    private RdActivityService rdActivityService;
    /**
     * 根据房源编号查询活动优惠之后的价格
     */
    @PostMapping("/getOptimalActivity")
    public JsonResult getOptimalActivity(@RequestBody Map<String,Object> params){
        JsonResult result=new JsonResult();
        Map<String,Object> map=rdActivityService.getOptimalActivity(params);
        if (map!=null){
            result.put(map);
        }else{
            result.putFailed("服务器繁忙");
        }
        return result;
    }


    /**
     * 如果活动优惠为满减重新计算合同周期
     * @author zhoucong
     * @data 2019/10/14
     * @Param
     * @return
     */
    @PostMapping("/getActIdSend")
    public JsonResult getActIdSend(@RequestBody Map<String,Object> params){
        return rdActivityService.getActIdSend(params);
    }
}
